﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BIExtAuth.BLL;

namespace BIExtAuth.Web.Admin
{
    public partial class RefreshCube : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            string srvAddr = this.txtDataSource.Text.Trim();
            string userName = @"administrator";
            string userPwd = @"xiongP@ssword";
            string connString = @"Provider=MSOLAP.5;Data Source=" + srvAddr + @";User ID=" + userName + @";Password=" + userPwd + @";Persist Security Info=true";//Impersonation Level=Impersonate
            SSASMGBLL asMGBLL = new SSASMGBLL(connString);
            Microsoft.AnalysisServices.DatabaseCollection dbList = asMGBLL.GetAllDatabase();
            if (dbList != null)
            {
                this.lbxCube.Items.Clear();
                for (int i = 0; i < dbList.Count; i++)
                {
                    this.lbxCube.Items.Add(new ListItem(dbList[i].Name));
                }
            }
        }
    }
}